<?php

/**
* @copyright	http://www.easymvc.com
* @author 		光哥  <439884988@qq.com>
* @version		1.0 - 2012-03-26
* @package		Frame
* 
*/

class AutoLoad {
	public static $cache_autoload;
	public static $cache_file;
	public static $init;
	
	/**
	 * 初始化
	 */
	public static function init(){
		
		
	}
	
	/*
	 * 自动加载类
	 * @param string $class
	 * @return boolean
	 */
	public static function auto_load($class){
		$file = str_replace('_','/',strtolower($class));
		if(strpos($file,"lib") === 0){
			$file = LIBPATH.substr($file,4).'.php';
		}elseif(strpos($file,"frame") === 0){
			$file = FRAMEPATH.substr($file,6).'.php';
		}elseif(strpos($file,"smarty") === 0 ){
			$file = EXTENDPATH.'Smarty-3.0.9/libs/sysplugins/'.strtolower($class).'.php';
		}else{
			$file = APPPATH.$file.'.php';
		}
		
		if(DEBUG && !file_exists($file)){
			throw new Frame_Exception_Program(" class ".$class." no exists ");
		}
		require $file;
		
	}
}


?>